package com.wondertek.mam.tag.domain;

import org.hibernate.annotations.GenericGenerator;

import javax.persistence.*;
import java.time.LocalDate;
import java.time.LocalDateTime;

/**
 * tag 表实体类
 * Created by wangdongxu on 2017-09-07 上午 9:25:39.
 */
@Entity
@Table(name = "TAG")
public class TagDB {
    private int id;
    private String tag;
    private LocalDateTime updateTime;
    private LocalDateTime createTime;
    private Integer score;
    private Boolean Hot;
    private LocalDate protectedTime;
    private Integer groupId;
    private Integer classId;
    public TagDB() {
    }


    public TagDB(String tag, LocalDateTime updateTime, LocalDateTime createTime, Integer score, Boolean hot, LocalDate protectedTime, Integer groupId, Integer classId) {
        this.tag = tag;
        this.updateTime = updateTime;
        this.createTime = createTime;
        this.score = score;
        Hot = hot;
        this.protectedTime = protectedTime;
        this.groupId = groupId;
        this.classId = classId;
    }

    @SequenceGenerator (name = "TAG_SEQ", sequenceName = "TAG_SEQ", allocationSize = 1)
    @Id
    @GeneratedValue(strategy = GenerationType.SEQUENCE,generator = "TAG_SEQ")
    @Column(name = "ID")
    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    @Basic
    @Column(name = "TAG")
    public String getTag() {
        return tag;
    }

    public void setTag(String tag) {
        this.tag = tag;
    }

    @Basic
    @Column(name = "UPDATE_TIME")
    public LocalDateTime getUpdateTime() {
        return updateTime;
    }

    public void setUpdateTime(LocalDateTime updateTime) {
        this.updateTime = updateTime;
    }

    @Basic
    @Column(name = "SCORE")
    public Integer getScore() {
        return score;
    }

    public void setScore(Integer score) {
        this.score = score;
    }

    public Boolean getHot() {
        return Hot;
    }

    @Basic
    @Column(name = "HOT")
    public void setHot(Boolean hot) {
        Hot = hot;
    }

    @Basic
    @Column(name = "CREATE_TIME")
    public LocalDateTime getCreateTime() {
        return createTime;
    }

    public void setCreateTime(LocalDateTime createTime) {
        this.createTime = createTime;
    }

    @Basic
    @Column(name = "PROTECTED_TIME")
    public LocalDate getProtectedTime() {
        return protectedTime;
    }

    public void setProtectedTime(LocalDate protectedTime) {
        this.protectedTime = protectedTime;
    }

    @Basic
    @Column(name = "GROUP_ID")
    public Integer getGroupId() {
        return groupId;
    }

    public void setGroupId(Integer groupId) {
        this.groupId = groupId;
    }

    @Basic
    @Column(name = "CLASS_ID")
    public Integer getClassId() {
        return classId;
    }

    public void setClassId(Integer classId) {
        this.classId = classId;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (!(o instanceof TagDB)) return false;

        TagDB tagDB = (TagDB) o;

        if (id != tagDB.id) return false;
        if (tag != null ? !tag.equals(tagDB.tag) : tagDB.tag != null) return false;
        if (updateTime != null ? !updateTime.equals(tagDB.updateTime) : tagDB.updateTime != null) return false;
        if (createTime != null ? !createTime.equals(tagDB.createTime) : tagDB.createTime != null) return false;
        if (score != null ? !score.equals(tagDB.score) : tagDB.score != null) return false;
        if (Hot != null ? !Hot.equals(tagDB.Hot) : tagDB.Hot != null) return false;
        if (protectedTime != null ? !protectedTime.equals(tagDB.protectedTime) : tagDB.protectedTime != null)
            return false;
        if (groupId != null ? !groupId.equals(tagDB.groupId) : tagDB.groupId != null) return false;
        return classId != null ? classId.equals(tagDB.classId) : tagDB.classId == null;
    }

    @Override
    public int hashCode() {
        int result = id;
        result = 31 * result + (tag != null ? tag.hashCode() : 0);
        result = 31 * result + (updateTime != null ? updateTime.hashCode() : 0);
        result = 31 * result + (createTime != null ? createTime.hashCode() : 0);
        result = 31 * result + (score != null ? score.hashCode() : 0);
        result = 31 * result + (Hot != null ? Hot.hashCode() : 0);
        result = 31 * result + (protectedTime != null ? protectedTime.hashCode() : 0);
        result = 31 * result + (groupId != null ? groupId.hashCode() : 0);
        result = 31 * result + (classId != null ? classId.hashCode() : 0);
        return result;
    }

    @Override
    public String toString() {
        return "TagDB{" +
            "id=" + id +
            ", tag='" + tag + '\'' +
            ", updateTime=" + updateTime +
            ", createTime=" + createTime +
            ", score=" + score +
            ", Hot=" + Hot +
            ", protectedTime=" + protectedTime +
            ", groupId=" + groupId +
            ", classNum=" + classId +
            '}';
    }
}
